import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int[] arr = new int[n];
        int sum = 0;
        int mul = 1;
        int num = 0;
        //判断一开始是否是幸运的
        boolean isluckey = true;
        for(int i = 0;i<n;i++) {
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);   
        System.out.println(dfs(arr,0,0,1));
    }
     private static int dfs(int[] arr,int index,int sum,int mul) {
         int count = 0;
         for(int i = index;i<arr.length;i++) {
             sum+=arr[i];
             mul*=arr[i];
             if(sum>mul) {
                 count += 1 + dfs(arr,i+1,sum,mul);
             }else if(arr[i] == 1) {
                 count += dfs(arr,i+1,sum,mul);
             }else {
                 break;
             }
             sum-=arr[i];
             mul/=arr[i];
             while(i<arr.length-1 &&arr[i] == arr[i+1]) {
                 i++;
             }
         }
         return count;
     }
}